package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class FindOperation implements IOPeration  {
    public void work(BookList bookList) {
        System.out.println("查找图书");
        System.out.println("请输入你要查找的图书的名字：");
        Scanner sc=new Scanner(System.in);
        String name=sc.nextLine();
        int index=0;
        int current=bookList.getUsedSize();
        int i=0;
        for (;i<current;i++){
            Book book= bookList.getPos(i);//getpos是一个book类
            if(book.getName().equals(name)){
                System.out.println("找到这本书了"+book);
                return ;
            }
        }
    }
}
